<template>
    <div>
        <h1 :style="{opacity}">生命周期</h1>
    </div>
</template>
<script>
export default {
    data() {
        return {
           opacity:1,
           mySetInterval: null,
        }
    },
    
    
    methods:{
        change() {
           this.mySetInterval= setInterval(()=>{
                this.opacity -= 0.01
                if (this.opacity <= 0) {
                    this.opacity = 1
                }
            },16) 
        }
    },
    
    beforeCreate() {
        console.log('beforeCreate...');
    },
    created(){
         console.log('created...');
    },
    beforeMount() {
        console.log('beforeMount...');
    },
    mounted:function(){
        console.log('mounted...');
        this.change()
    },
    beforeUpdate() {
        console.log('beforeUpdate...');
    },
    
    updated() {
        console.log('updated...');
    },
    
    beforeDestroy() {
        console.log('beforeDestroy...');
        clearInterval(this.mySetInterval);
    },
    destroyed(){
        console.log('destroyed...');
    }
}
</script>